package chapter5;
import java.util.Scanner;
/****************************************************************
 * Author：icynlau
 * Description: 计算CD价值
 * Date:2021/4/3
 * ***************************************************************
 */
public class exc5_31 {
	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		System.out.print("Enter the initial deposit amount: ");
		double amount=input.nextDouble();
		System.out.print("Enter annual percentage yield : ");
		double yearRate=input.nextDouble()/100.0;
		double monthRate=yearRate/12.0;
		System.out.print("Enter maturity period ( number of months ):");
		int nMonth=input.nextInt();
		
		System.out.print("Month      CD Value\n");
		for(int i=1;i<=nMonth;i++) {
			amount*=(1+monthRate);
			System.out.printf("%d        \t%.2f\n", i,amount);
		}
		
	}

}
